<%-- 
    Document   : Sp_CenterContainer_Order
    Created on : Apr 7, 2015, 1:19:57 PM
    Author     : PHATNBSE61057
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>

<!DOCTYPE html>
<c:set var="cartError" value="${requestScope.CARTERROR}"/>
<c:set var="cartEmpty" value="${sessionScope.CART}"/>
<c:set var="orderList" value="${requestScope.ORDERLIST}"/>
<c:set var="user" value="${sessionScope.USER}"/>

<td class="centerContainer">
    <div class="c1">
        <div class="c2">
            <div class="top"></div>
        </div>
    </div>
    <div class="content">
        <div class="content-wrapper">
            <a name="main"></a>
            <span id="serch_error">
            </span>
            <div id="pageTitle" class="pageTitleSection">
                <div class="block">
                    <div class="cont">
                        <h2>
                            <c:if test="${user.roleID == 1}">
                                <span>All order in this week</span>
                            </c:if>
                            <c:if test="${user.roleID != 1}">
                                <span>Your orders</span>
                            </c:if>
                        </h2>
                    </div>
                </div>
            </div>

            <c:if test="${empty orderList and user.roleID == 1}">
                <div class="shoppingCartSection">
                    <div class="block">
                        <div class="corner1">
                            <div class="corner2">
                                <div class="lineTop"></div>
                            </div>
                        </div>
                        <div class="cont">
                            <p>You did not order anything</p>
                        </div>
                        <div class="corner4">
                            <div class="corner3">
                                <div class="lineBtm"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </c:if>

            <!--INFO OF STAFF-->
            <c:if test="${not empty orderList}">
                <div class="shoppingCartSection">
                    <div class="block">
                        <div class="cont">
                            <form action="ProcessServlet" method="POST">

                                <div class="wrapperShoppingCartDet">

                                    <div class="shoppingCartDet">
                                        <table class="base">
                                            <thead>
                                                <tr>
                                                    <th class="productName">Username</th>
                                                    <th>Booking Time</th>
                                                    <th class="price">Total</th>
                                                    <th class="subtotal">Status</th>
                                                    <th class="del">Process</th>
                                                    <th class="del">Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <c:forEach var="order" items="${orderList}">
                                                    <tr class="">
                                                        <td class="productImage grid_2">
                                                            ${order.username}
                                                        </td>
                                                        <td>
                                                            ${order.bookingTime}
                                                        </td>
                                                        <td class="subtotal">
                                                            £${order.totalPrice}
                                                        </td>
                                                        <td class="price">
                                                            <c:if test="${order.statusID == 1}">
                                                                Processing
                                                            </c:if>
                                                            <c:if test="${order.statusID == 2}">
                                                                Completed
                                                            </c:if>
                                                        </td>

                                                        <td>
                                                            <c:if test="${order.statusID == 1}">
                                                                <form action="ProcessServlet" method="POST">
                                                                    <a href="ProcessServlet?btAction=Process&txtOrderID=${order.orderID}">Process</a>
                                                                </form>
                                                            </c:if>
                                                        </td>
                                                        <td>
                                                            <form action="ProcessServlet" method="POST">
                                                                <a href="ProcessServlet?btAction=Detail&txtOrderID=${order.orderID}">Details</a>
                                                            </form>
                                                        </td>
                                                    </tr>
                                                </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>

                                    <div class="nofloat"></div>
                                </div>

                                <div class="nofloat"></div>
                            </form>
                        </div>
                        <div class="corner4">
                            <div class="corner3">
                                <div class="lineBtm"></div>
                            </div>
                        </div>
                    </div>
                    <div class="nofloat"></div>
                </div>
            </c:if>

            <!--INFO OF CUSTOMER--> 
            <c:if test="${empty orderList and user.roleID != 1 }">
                <div class="shoppingCartSection">
                    <div class="block">
                        <div class="cont">
                            <form action="ProcessServlet" method="POST">

                                <div class="wrapperShoppingCartDet">

                                    <div class="shoppingCartDet">
                                        <table class="base">
                                            <thead>
                                                <tr>
                                                    <th class="productName">Username</th>
                                                    <th>Booking Time</th>
                                                    <th class="price">Total</th>
                                                    <th class="subtotal">Status</th>
                                                    <th class="del">Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                                <c:import url="xml/ordersData.xml" var="xmldoc"/>
                                                <c:import url="xml/orderResult.xsl" var="xsldoc"/>
                                                <x:transform xml="${xmldoc}" xslt="${xsldoc}"/>

                                            </tbody>
                                        </table>
                                    </div>

                                    <div class="nofloat"></div>
                                </div>

                                <div class="nofloat"></div>
                            </form>
                        </div>
                        <div class="corner4">
                            <div class="corner3">
                                <div class="lineBtm"></div>
                            </div>
                        </div>
                    </div>
                    <div class="nofloat"></div>
                </div>
            </c:if>
        </div>
    </div>
    <div class="c4">
        <div class="c3">
            <div class="btm"></div>
        </div>
    </div>
</td>